// mail/mail.processor.ts
import { Process, Processor } from '@nestjs/bull';
import { Job } from 'bull';

@Processor('mail')
export class MailProcessor {
  @Process('send')
  async handleSendMail(job: Job) {
    const { to, subject, content } = job.data;
    // 实际发送邮件逻辑（可调用第三方服务）
    await new Promise((resolve) => setTimeout(resolve, 1000)); // Simulating async email sending
    console.log(`发送${content}邮件到: ${to}, 主题: ${subject}`);
    return true;
  }
}
